﻿<!DOCTYPE>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath(); 
	//获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量 
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
	pageContext.setAttribute("basePath",basePath); 
	pageContext.setAttribute("path",path); 
%>    
<html>
<head>
<link rel="stylesheet" type="text/css" href="${basePath}css/style.css"/>
<link rel="stylesheet" type="text/css" href="${basePath}css/external.min.css" />
<link rel="stylesheet" type="text/css" href="${basePath}css/popup.css"/>
<script type="text/javascript" src="${basePath}js/jquery-3.2.1.js"></script>
<title>基本信息</title>
<meta content="description" name="description">
<meta content="keywords" name="keywords">
</head>

<body>
<div id="body">
	<%@include file="../header.jsp"%>
    <!-- end #header -->
    
    <div id="container">
          		
        <div class="content_mid">
        	<dl class="c_section c_section_mid">
                <dt>
                    <h2><em></em>填写公司信息</h2>
                </dt>
                <dd>
	                <form id="stepForm">
	                	<div class="c_text_1">基本信息为必填项，是求职者加速了解公司的窗口，认真填写吧！</div>
	                    <h3>公司名称</h3> <!--非必填-->
	                    <input type="text" placeholder="请输入公司名称" value="" name="name" id="name" class="valid">	
	                    <h3>所在城市</h3>
	                    <input type="text" placeholder="请输入工作城市" name="city" id="city">	
	                    <h3>行业领域</h3>
	                    <input type="text" placeholder="请输入行业领域" name="industry" id="industry">	
	                    <h3>公司规模</h3>
	                    <input type="text" placeholder="请输入公司人次" name="scale" id="scale">	
	                    <h3>福利</h3>
	                    <input type="text" placeholder="请输入公司福利" name="welfare" id="welfare">	
	                    <h3>一句话介绍</h3> 
	                    <input type="text" placeholder="一句话概括公司亮点，如公司愿景、领导团队等，限50字" maxlength="50" name="temptation" id="temptation">	
	                    <!-- <input type="submit" value="保存，下一步" id="stepBtn" class="btn_big fr"> -->
	                    <a  href="javascript:check();" class="btn_big fr" title="保存，下一步"/>保存，下一步</a>
	                </form>
                </dd>
            </dl>
       	</div>


<script>
function check(){
	var name =$('#name').val();
	var city =$('#city').val();
	var industry =$('#industry').val();
	var scale =$('#scale').val();
	var temptation =$('#temptation').val();
	var welfare =$('#welfare').val();
	if(name == null || name == undefined){alert("请输入公司名");return ;}
	if(city == null || city == undefined){alert("请输入公司所在城市");return ;}
	if(industry == null || industry == undefined){alert("请输入公司领域");return ;}
	$.ajax({
		type:'POST',
    	data: {
    		name:name,
    		city:city,
    		industry:industry,
    		scale:scale,
    		temptation:temptation,
    		welfare:welfare
    		},
    	url:'${basePath}hr/createCompany',
    	dataType:'json',
    	success:function(result){
    		console.log("success");
    		var model = result.model;
        	if(model.code==0){
        		console.log(model.msg);
        		window.location.href="${basePath}" + model.href;
        	}else{
        		alert(model.msg);
        		console.log(model.msg);
        	}
    	}
	});
}
</script>
</body>
</html>